# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=libxkbcommon
pkgver=0.10.0
pkgrel=2
pkgdesc="a keyboard handling library"
url="https://www.xkbcommon.org/"
arch="all"
license="MIT"
depends="xkeyboard-config"
depends_dev="libxkbcommon-x11=$pkgver-r$pkgrel"
makedepends="
	bison
	wayland-dev
	wayland-protocols
	libxcb-dev
	meson"
checkdepends="bash"
subpackages="$pkgname-static $pkgname-dev $pkgname-x11"
source="$pkgname-$pkgver.tar.gz::https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-$pkgver.tar.gz"
builddir="$srcdir/libxkbcommon-xkbcommon-$pkgver"

build() {
	meson \
		--prefix=/usr \
		--buildtype=plain \
		-Denable-wayland=true \
		-Denable-docs=false \
		-Denable-x11=true \
		-Ddefault_library=both \
		build
	ninja -C build
}

check() {
	ninja -C build test
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
}

x11() {
	pkgdesc="$pkgdesc (x11 support)"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*x11*.so.* "$subpkgdir"/usr/lib
}

sha512sums="682a08124491ba9115011b145836ffac26932acdd804a76f7fb076b6f12b8a1ad23480e6272cb5c374cde7fb6c32ce2bb431b8b3e15316f132f236367ca1a964  libxkbcommon-0.10.0.tar.gz"
